home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / GRAPHICS.SWG / 0098_Screen Dump To File.pas < prev    next >
Pascal/Delphi Source File  |  1994-05-26  |  1KB  |  45 lines

  1.  {
  2.    DUMPSCR.PAS
  3.    Demo to dump a 25 line screen to disk and then restore it
  4.    By Martin Richardson
  5.    (This code is Public Domain... Enjoy!)
  6.  }
  7.  USES CRT;
  8.  
  9.  TYPE
  10.     ScreenArray = ARRAY[1..25 * 80] OF WORD;
  11.     ScreenPtr = ^ScreenArray;
  12.  
  13.  VAR
  14.    _Screen: ScreenPtr;
  15.    fHandle: FILE;
  16.    ScreenRows: BYTE;
  17.  
  18.  BEGIN
  19.      IF (LastMode = Mono) THEN
  20.         _Screen := PTR( $B000, 0 )
  21.      ELSE
  22.         _Screen := PTR( $B800, 0 );
  23.  
  24.      ASSIGN( fHandle, 'DUMP.SCR' );
  25.  
  26.  { First we save the screen to the file DUMP.SCR }
  27.      REWRITE( fHandle, 1 );
  28.      BLOCKWRITE( fHandle, _Screen^, SIZEOF( _Screen^ ) );
  29.      CLOSE( fHandle );
  30.  
  31.  { Now a little pause as we catch our breath }
  32.      CLRSCR;
  33.      WRITELN( 'Press any key...' );
  34.      WHILE READKEY = #0 DO;
  35.  
  36.  { And finally we restore the screen from the file DUMP.SCR }
  37.      RESET( fHandle, 1 );
  38.      BLOCKREAD( fHandle, _Screen^, SIZEOF( _Screen^ ) );
  39.      CLOSE( fHandle );
  40.  
  41.  { Another pause to view our handiwork }
  42.      WHILE READKEY = #0 DO;
  43.  END.
  44.  
  45.